import { axios as request } from '@/utils/request'

// 查询全部部署的流程定义
export function getPageList(params) {
  return request({
    url: `/workflow/deploy/all`,
    method: 'get',
    params
  })
}

// 激活流程定义
export function activate(id) {
  return request({
    url: `/workflow/deploy/activate/${id}`,
    method: 'get'
  })
}

// 挂起流程定义
export function suspend(id) {
  return request({
    url: `/workflow/deploy/suspend/${id}`,
    method: 'get'
  })
}

// 测试获取流程节点属性
export function test(processDefinitionId) {
  return request({
    url: `/workflow/deploy/test/${processDefinitionId}`,
    method: 'get'
  })
}

// 部署流程定义
export function save(id) {
  return request({
    url: `/workflow/deploy/save/${id}`,
    method: 'get'
  })
}

// 删除部署的流程
export function remove(id) {
  return request({
    url: `/workflow/deploy/del/${id}`,
    method: 'delete'
  })
}

// 新建/编辑流程时获取子流程列表
export function getProcessList() {
  return request({
    url: `/workflow/deploy/getProcessList`,
    method: 'get'
  })
}

// 根据流程定义key获取最新的流程定义
export function getByKey(definitionKey) {
  return request({
    url: `/workflow/deploy/getByKey/${definitionKey}`,
    method: 'get'
  })
}

// 根据部署Id查询部署信息
export function getDeployInfo(deploymentId) {
  return request({
    url: `/workflow/deploy/get/${deploymentId}`,
    method: 'get'
  })
}

